package org.example.permissionservice.service;

import org.example.permissionservice.mapper.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionService {

    @Autowired
    private RoleMapper roleMapper;

    public void bindDefaultRole(Long userId) {
        roleMapper.bindDefaultRole(userId);
    }

    public String getUserRoleCode(Long userId) {
        return roleMapper.getUserRoleCode(userId);
    }

    public void upgradeToAdmin(Long userId){
        roleMapper.upgradeToAdmin(userId);
    }

    public void downgradeToUser(Long userId){
        roleMapper.downgradeToUser(userId);
    }

    public List<Long> getNormalUser(){
        return roleMapper.getNormalUser();
    }

}
